package com.ssy.lingxi.transaction.controller.feign;

import com.ssy.lingxi.common.controller.BaseController;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.transaction.api.dto.request.InquiryProductPriceRequest;
import com.ssy.lingxi.transaction.api.dto.response.InquiryListProductResponse;
import com.ssy.lingxi.transaction.api.dto.response.InquiryProductPriceResponse;
import com.ssy.lingxi.transaction.service.IQuoteService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 内部接口类
 * @author jw.chen
 * @version 2.0.0
 * @date 2022/1/19
 */
@RestController
@RequestMapping("/transaction/feign")
public class TradeFeignController extends BaseController {

    @Resource
    IQuoteService quoteService;

    /**
     * 通过报价单号查询询价单商品详情
     */
    @RequestMapping(value = "/getInquiryProduct", method = RequestMethod.GET)
    public Wrapper<List<InquiryListProductResponse>> getInquiryProduct(@RequestParam(name = "quotationNo")String quotationNo) {
        return Wrapper.success(quoteService.getInquiryProduct(quotationNo));
    }

    /**
     * 通过商品skuId批量查询商品对应的供应商最后一次报价
     */
    @RequestMapping(value = "/getInquiryProductPrice", method = RequestMethod.POST)
    public Wrapper<List<InquiryProductPriceResponse>> getInquiryProductPrice(@RequestBody InquiryProductPriceRequest inquiryProductPriceRequest) {
        return Wrapper.success(quoteService.getInquiryProductPrice(inquiryProductPriceRequest));
    }
}
